package cn.tedu.home1ess.admin.traffic.dao.repository.impl;

import cn.tedu.home1ess.admin.traffic.dao.mapper.TrafficMapper;
import cn.tedu.home1ess.admin.traffic.dao.repository.ITrafficRepository;
import cn.tedu.home1ess.admin.traffic.pojo.po.MapTrafficPO;
import cn.tedu.home1ess.admin.traffic.pojo.po.RecentTrafficPO;
import cn.tedu.home1ess.admin.traffic.pojo.po.TOPTrafficPO;
import cn.tedu.home1ess.admin.traffic.pojo.po.TrafficPO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.Collections;
import java.util.Date;
import java.util.List;

@Repository
public class TrafficRepositoryImpl implements ITrafficRepository {
    @Autowired
    private TrafficMapper trafficMapper;

    @Override
    public void addUserCount(Date date) {
        trafficMapper.addUserCount(date);
    }

    @Override
    public void addTrafficCount(Date date) {
        trafficMapper.addTrafficCount(date);
    }

    @Override
    public List<MapTrafficPO> getMapTraffic() {

        return Collections.emptyList();
    }

    @Override
    public List<TOPTrafficPO> getTopTraffic() {

        return Collections.emptyList();
    }

    @Override
    public List<RecentTrafficPO> getRecentTraffic() {

        return Collections.emptyList();
    }

    @Override
    public TrafficPO selectRealTime() {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.orderByDesc("date",new Date());
        return trafficMapper.selectOne(queryWrapper);
    }

    @Override
    public void createCount(TrafficPO trafficPO) {
        trafficMapper.insert(trafficPO);
    }
}
